﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php
using System;

namespace DNA.Mvc.Notification
{
    /// <summary>
    /// Define the methods to send and subscribe messages.
    /// </summary>
    public interface INotificationService
    {
        /// <summary>
        /// Send mesage.
        /// </summary>
        /// <param name="token">The token that identity the subscription list.</param>
        /// <param name="message">Specified the mesasge object.</param>
        void Send(string token, DNA.Mvc.IMessage message);

        /// <summary>
        /// Send mesage.
        /// </summary>
        /// <param name="token">The token that identity the subscription list.</param>
        /// <param name="title">Specified the message title.</param>
        /// <param name="content">Specified the message content.</param>
        /// <param name="contentType">Identity the message content type.</param>
        /// <param name="encoding">Specified the content encoding.</param>
        void Send(string token, string title, string content, string contentType = "text/html", string encoding = "utf-8", string type = "");

        /// <summary>
        /// Gets whether is the user  in subscription list.
        /// </summary>
        /// <param name="token">The token that identity the subscription list.</param>
        /// <param name="userName">The registered user name.</param>
        /// <returns>Return true when user is in subscription list.</returns>
        bool IsSubscribed(string token, string userName);

        /// <summary>
        /// Add the user to the subscription list.
        /// </summary>
        /// <param name="token">The token that identity the subscription list.</param>
        /// <param name="userName">The registered user name.</param>
        /// <returns>Returns true when success.</returns>
        bool Subscribe(string token, string userName);

        /// <summary>
        /// Remove the user from the subscription list.
        /// </summary>
        /// <param name="token">The token that identity the subscription list.</param>
        /// <param name="userName">The registered user name.</param>
        void Unsubscribe(string token, string userName);

        /// <summary>
        /// Gets a subscription list by specified token.
        /// </summary>
        /// <param name="token">Specified the subscription list token.</param>
        /// <returns>Returns user name arrary.</returns>
        string[] GetSubscribers(string token);
    }
}
